package com.fanjun.learning.drools;

import org.kie.api.command.Command;
import org.kie.internal.runtime.StatefulKnowledgeSession;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * <p>规则引擎Drools</p>
 */
public class DroolsTest {

    public static void main(String[] args){
        ClassPathXmlApplicationContext applicationContext =  new ClassPathXmlApplicationContext( "applicationContext.xml" );
        StatefulKnowledgeSession kSession = (StatefulKnowledgeSession) applicationContext.getBean( "ksession" );
        Message message = new Message();
        message.setStatus(Message.HELLO);
        message.setMessage("Hello World");
        kSession.insert(message);
        kSession.fireAllRules();

    }

}
